{include file="header"}
<div style="padding: 20px;" class="adminmyucms">
<form class="layui-form" action="">
<table class="layui-table">
  <colgroup>
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>用户名</th>
      <th>邮箱</th>
      <th>状态</th>
      <th>密码</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    <tr>
      <td><input type="text" name="username" value=""  placeholder="用户名" autocomplete="off" lay-verify="required" class="layui-input"></td>
      <td><input type="text" name="usermail" value=""  placeholder="请输入" autocomplete="off"  lay-verify="required"  class="layui-input"></td>
      <td>     
      <select name="open" lay-verify="required">
      	<option value="1">正常</option>
        <option value="0">关闭</option>
      </select>
      </td>
      <td><input type="text" name="password" value=""  lay-verify="required"  placeholder="请输入" autocomplete="off"  class="layui-input"></td>
      <td><button class="layui-btn layui-btn-warm" lay-submit lay-filter="set-add">添加用户</button></td>
    </tr>
  </tbody>
</table>
</form>
<form class="layui-form" action="{:url('member/index',array('id'=>input('id')))}" method="get">
<input placeholder="输入关键字" name="ks" value="<?php echo input('ks');?>" type="text" class="layui-input" style="float: left;margin-right: 10px;width: 240px;">
<button class="layui-btn" style="float: left;" value="查询" type="submit">查询</button>
</form>
<hr style="padding:10px; background-color: #fff">
<table class="layui-table">
  <colgroup>
    <col width="80">
    <col width="100">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>UID</th>
      <th>用户名</th>
      <th>邮箱</th>
      <th>手机号码</th>
      <th>状态</th>
      <th>会员等级</th>
      <th>注册时间</th>
      <th>最后登录时间</th>
      <th>最后登录IP</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
{volist name="html" id="vo"}
    <tr  class="layui-form">
      <th>{$vo.userid}</th>
      <th><a target="_blank" href="*URL*/uid_{$vo.userid}.html">{$vo.username}</a></th>
      <th><a target="_blank" href="*URL*/uid_{$vo.userid}.html">{$vo.usermail}</a></th>
      <th>{$vo.phone}</th>
            <th>
      <input type="checkbox" lay-skin="switch"  url="{:url("member/update_index")}?id={$vo.userid}&m=member&or=open"  lay-submit lay-filter="index" value="{$vo.userid}" lay-text="开启|关闭"  {if condition="$vo['open'] eq 1"}checked{/if}>
      </th>
      <th>{:qxz($vo['userid'],1)}</th>
      <th>{$vo.regtime|timeinfo}</th>
      <th>{$vo.last_login_time|timeinfo}</th>
      <th>{$vo.last_login_ip}</th>

      <th>
      	<div class="layui-btn-group" id="admin_set">
      		 <button  data-method="admin_set" member-id="{$vo.userid}" url="/admin.php/member/edit/id/{$vo.userid}.html" type="button" class="layui-btn layui-btn-lg layui-btn-normal layui-btn-sm"> <i class="layui-icon">&#xe642;</i>修改</button>
      		 <button  member-name="确定要删除 {$vo.username} 吗?" url="{:url("member/delete")}?id={$vo.userid}&m=member" lay-submit lay-filter="delete"  class="layui-btn layui-btn-danger layui-btn-sm"> <i class="layui-icon">&#xe640;</i>删除</button>
        </div>
      </th>
    </tr>
{/volist} 
  </tbody>
</table>
<div class="pages">
{$html->render()}
<div>
<div>
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;
  //添加
  form.on('submit(set-add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("member/insert")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
})
layui.use('laydate', function(){
  var laydate = layui.laydate;
  laydate.render({
    elem: '#time'
  });
});
</script>
</div>  
{include file="footer"}